<%@ page contentType="text/html;charset=UTF-8" %>
<%@ include file="/WEB-INF/views/include/taglib.jsp" %>
<script>
    function page(n,s){
        $("#pageNo").val(n);
        $("#pageSize").val(s);
        $("#itemsForm").submit();
        return false;
    }
    $(function(){
        var totalCosts = '${totalCost}' ;
        $("#totalCosts").val(totalCosts);
    })
</script>
<div class="col-lg-3">
    <section class="panel panel-default">
        <div class="panel-body">
            <table class="table table-bordered mg-t datatable">
                <thead>
                <tr>
                    <th>支付方式</th>
                    <th>金额</th>
                </tr>
                </thead>
                <tbody>
                <c:forEach  items="${list}" var="payments">
                    <tr>
                        <td>${fns:getDictLabel(payments.moneyType, 'PAY_WAY_DICT', '')}</td>
                        <td>${payments.charges}</td>
                        <c:set var="totalCosts" value="${totalCosts+payments.charges}" ></c:set>
                    </tr>
                </c:forEach>
                <tr>
                    <td>合计：</td>
                    <td><c:out value="${totalCosts}"></c:out></td>

                </tr>
                </tbody>
            </table>
        </div>
    </section>
</div>
<div class="col-lg-9" id="itemsDiv">
    <section class="panel panel-default">
        <div class="panel-body">
            <form:form hidden="hidden" id="itemsForm" modelAttribute="examApply"
                       onsubmit="return loadDivForm('itemsDiv','itemsForm','${ctx}/finance/outpRcptMaster/getBillItems');"
                       method="post" class="form-inline">
                <input id="pageNo" name="pageNo" type="hidden" value="${page.pageNo}"/>
                <input id="pageSize" name="pageSize" type="hidden" value="${page.pageSize}"/>
            </form:form>
            <table class="table table-bordered mg-t datatable">
                <thead>
                <tr>
                    <th>项目类型</th>
                    <th>项目名称</th>
                    <th>项目编码</th>
                    <th>数量</th>
                    <th>应收费用</th>
                    <th>实收费用</th>
                </tr>
                </thead>
                <tbody>
                <c:forEach  items="${page.list}" var="billItem">
                    <tr>
                        <td>${fns:getDictLabels(billItem.itemClass,'BILL_ITEM_CLASS_DICT','')}</td>
                        <td>${billItem.itemName}</td>
                        <td>${billItem.itemCode}</td>
                        <td>${billItem.num}</td>
                        <td>${billItem.costs}</td>
                        <td>${billItem.charges}</td>
                        <c:set var="costs" value="${costs+billItem.costs}"></c:set>
                        <c:set var="totalCharges" value="${totalCharges+billItem.charges}"></c:set>
                    </tr>
                </c:forEach>
                <tr>
                    <td></td>
                    <td></td>
                    <td></td>
                    <td>合计：</td>
                    <td><c:out value="${costs}"></c:out></td>
                    <td><c:out value="${totalCharges}"></c:out></td>
                </tr>
                </tbody>
            </table>
            <div class="pagination">${page}</div>
        </div>
    </section>
</div>


